package com.mtnz.njk.controller;

import com.mtnz.njk.result.ResponseResult;
import com.mtnz.njk.service.QueryPesticideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cardId")
public class QueryCardIdController {

    @Autowired
    QueryPesticideService pesticideService;

    /**
     * 查询农药
     *
     * @param registeredNumber
     * @param companyName
     * @param effective
     * @return
     */
    @PostMapping("/queryPesticide")
    public ResponseResult queryPesticide(String registeredNumber, String companyName, String effective, String pesticideId, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) throws Exception{
        return pesticideService.queryPesticide(registeredNumber, companyName, effective, pesticideId,pageNum,pageSize);
    }

    /**
     * 查询肥料
     *
     * @param registeredNumber
     * @param companyName
     * @param effective
     * @return
     */
    @PostMapping("/queryManure")
    public ResponseResult queryManure(String registeredNumber, String companyName, String effective, String manureId, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize)  throws Exception{
        return pesticideService.queryManure(registeredNumber,companyName,effective,manureId,pageNum,pageSize);
    }
}
